Skip to content

Conversation

kwang-12
Copy link

@kwang-12 kwang-12 commented Sep 25, 2025

Description

This PR directly addresses #3559.

Type of change

  • New feature (non-breaking change which adds functionality)

Checklist

  • I have read and understood the contribution guidelines
  • I have run the pre-commit checks with ./isaaclab.sh --format
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • I have updated the changelog and the corresponding version in the extension's config/extension.toml file
  • I have added my name to the CONTRIBUTORS.md or my name already exists there

@rowoflo
Copy link

rowoflo commented Oct 8, 2025

I was blocked by not being able to specify the python path to uv as well. I wrote a fix but then found this PR. The diff for my fix is below. You might want to use the portion that has it default to a given Python version based on the Isaac Sim version as stated here.

╰─$ git diff
diff --git a/isaaclab.sh b/isaaclab.sh
index 263ff88e8a..92f66eb9d3 100755
--- a/isaaclab.sh
+++ b/isaaclab.sh
@@ -496,7 +496,8 @@ print_help () {
     echo -e "\t-d, --docs           Build the documentation from source using sphinx."
     echo -e "\t-n, --new            Create a new external project or internal task from template."
     echo -e "\t-c, --conda [NAME]   Create the conda environment for Isaac Lab. Default name is 'env_isaaclab'."
-    echo -e "\t-u, --uv [NAME]      Create the uv environment for Isaac Lab. Default name is 'env_isaaclab'."
+    echo -e "\t-u, --uv [NAME] [PYTHON_PATH]  Create the uv environment for Isaac Lab. Default name is 'env_isaaclab'."
+    echo -e "\t                     Optional PYTHON_PATH: Python interpreter path (e.g., '3.11', 'python3.10', or '/usr/bin/python3.11')."
     echo -e "\n" >&2
 }

@@ -599,8 +600,25 @@ while [[ $# -gt 0 ]]; do
                 uv_env_name=$2
                 shift # past argument
             fi
+
+            # check if python path is provided
+            if [ -n "$2" ] && [[ "$2" != -* ]]; then
+                echo "[INFO] Using python interpreter: $2"
+                python_path="$2"
+                shift # past argument
+            else
+                # use default python version based on Isaac Sim version
+                if is_isaacsim_version_4_5; then
+                    echo "[INFO] Detected Isaac Sim 4.5 → using python 3.10"
+                    python_path="3.10"
+                else
+                    echo "[INFO] Using default python 3.11"
+                    python_path="3.11"
+                fi
+            fi
+
             # setup the uv environment for Isaac Lab
-            setup_uv_env ${uv_env_name}
+            setup_uv_env ${uv_env_name} ${python_path}
             shift # past argument
             ;;
         -f|--format)

@KyleM73
Copy link
Contributor

KyleM73 commented Oct 13, 2025

I agree with @rowoflo that the default should be the version based on isaacsim (that's what I had intended the default behavior to be). Thanks for this PR! I'm not sure if you need so much context in the help script, but the core change + default fixes the problem.

@KyleM73
Copy link
Contributor

KyleM73 commented Oct 13, 2025

@kellyguo11 with a little polish this should solve #3524

@kwang-12
Copy link
Author

@KyleM73
The help texts was included to showcase how to use the option.
For my use case, I have multiple python3.11 installed so I need the path to be specific when creating the venv.

Comment on lines +501 to +509
echo -e "\t Optionally specify a Python interpreter path to use for the environment."
echo -e "\nExamples:"
echo -e "\t 1. uv environment creation:"
echo -e "\t\t1.a create env_isaaclab with system python3"
echo -e "\t\t$(basename "$0") --uv"
echo -e "\t\t1.b create myenv with system python3"
echo -e "\t\t$(basename "$0") --uv myenv "
echo -e "\t\t1.c create myenv with specified Python 3.11"
echo -e "\t\t$(basename "$0") --uv myenv --python ${HOME}/isaacsim50/kit/python/bin/python3"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this should go to the docs instead of having it here? Or maybe more optional, i.e. printed only when uv --help is passed? Otherwise it becomes many things.

echo "[INFO] Using uv environment name: $2"
uv_env_name=$2
shift # past argument
uv_env_name="env_isaaclab"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it better to just pass through all arguments from the user following --uv?

This will then include name, python path or other uv-related params that a user may want to pass through?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

infrastructure isaac-lab Related to Isaac Lab team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants